"use strict";
var _core = require("@pricking/core");
var _leanengine = _interopRequireDefault(require("leanengine"));
var _cloud = _interopRequireDefault(require("./cloud"));
var _configCenter = _interopRequireDefault(require("./config-center"));
function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
_leanengine.default.init({
    appId: process.env.LEANCLOUD_APP_ID || 'T51iKKGXz2t9OriABcYSeRac-MdYXbMMI',
    appKey: process.env.LEANCLOUD_APP_KEY || 'n57PqFRFsbwsSddDPO89Xpj5',
    masterKey: process.env.LEANCLOUD_APP_MASTER_KEY || '9wfTPNEVmSjkzMICbztkEMc4'
});
if (process.env.LEANCLOUD_APP_ID && !process.env.SELF_WEBSITE) {
    throw new Error('self_website is undefined');
}
new _core.PrickingApplication({
    rootPath: __dirname,
    port: Number(process.env.LEANCLOUD_APP_PORT || process.env.PORT || 3001),
    env: process.env.APP_ENV,
    mode: Number(process.env.APP_MODE),
    loadedCallback: ()=>{
        _configCenter.default.initial().then(()=>{
            (0, _cloud).default();
        }).catch((e)=>{
            console.trace(e);
            process.exit(0);
        });
    }
});
